package core.lib.network;

import java.util.Hashtable;

import core.lib.interfaces.ICRequestCallback;

public abstract class BaseProtocolContext
{
	private ICRequestCallback mCallback;
	private final Hashtable<String, Object> mParameters = new Hashtable<String, Object>();
	private byte[] mData;

	public void addParam(String key, Object param)
	{
		mParameters.put(key, param);
	}

	public byte[] getData()
	{
		return mData;
	}

	public Object getParam(String key)
	{
		return mParameters.get(key);
	}

	public void setData(byte[] data)
	{
		mData = data;
	}

	public boolean equals(Object o)
	{
		if (o.getClass() == getClass())
		{
			return equals((BaseProtocolContext) o);
		}
		else
		{
			return false;
		}
	}
	
	public abstract boolean equals(BaseProtocolContext o);
	
	public ICRequestCallback getCallback()
	{
		return mCallback;
	}

	public void setCallback(ICRequestCallback mCallback)
	{
		this.mCallback = mCallback;
	}
	
	public abstract Class<? extends BaseProtocolThread> getProtocolThreadClass();

}
